<?php $this->load->view('header/admin'); ?>
<div id="main">
    <div class="container">
        <div class="span-16 colborder" id="content">
        <?php if (isset($messages)) echo $messages; ?>
            <div class="span-16 last">
            <h3>Users: <?php echo count($users); ?></h3>
            </div>
            
            <div class="span-8">
                    <div class="box">
                        <h3 class="section-title">Admins</h3>
                        <p>Enter a name to search and then add the person</p>
                        <?php echo form_open('owner/role/admins/search'); ?>
                        <p>
                            <label for="admin_term" id="admin_name">Search</label> 
                            <input type="text" id="admin_autocomplete" name="admin_term" />
                        </p>
                        <p style="text-align: right; margin-right: 10px">
                            <input type="submit" name="action" value="Search" />
                        </p>
                        <?php echo form_close(); ?>
                        
                        <?php if (isset($admin_search_results) && count($admin_search_results) > 0): ?>
                        <?php echo form_open('owner/role/admins/add'); ?>
                        <p>
                            <label for="person" id="admin_name">Results</label>
                            <?php echo form_dropdown('admin_id', $admin_search_results); ?>
                        </p>
                        <p style="text-align: right; margin-right: 10px">
                            <input type="submit" name="action" value="Add" />
                        </p>
                        <?php echo form_close(); ?>
                        
                        <?php endif; ?>
                        <?php if (count($admins) > 0): ?>
                        <h5>List of admins</h5>
                        <ul>
                        <?php foreach ($admins as $e): ?>
                            <li>
                                <?php echo anchor('profile/person/edit/'.$e->id, $e->name); ?>
                                [<?php echo anchor('owner/role/admins/delete/'.$e->id, 'x')?>]
                            </li>
                        <?php endforeach; ?>
                        </ul>
                        <?php endif; ?>
                    </div>
            </div>
            
            <div class="span-8 last">
                    <div class="box">
                        <h3 class="section-title">Owners</h3>
                        <p>Enter a name to search and then add the person</p>
                        <?php echo form_open('owner/role/owners/search'); ?>
                        <p>
                            <label for="owner_term" id="owner_name">Search</label> 
                            <input type="text" id="owner_autocomplete" name="owner_term" />
                        </p>
                        <p style="text-align: right; margin-right: 10px">
                            <input type="submit" name="action" value="Search" />
                        </p>
                        <?php echo form_close(); ?>
                        
                        <?php if (isset($owner_search_results) && count($owner_search_results) > 0): ?>
                        <?php echo form_open('owner/role/owners/add'); ?>
                        <p>
                            <label for="person" id="owner_name">Results</label>
                            <?php echo form_dropdown('owner_id', $owner_search_results); ?>
                        </p>
                        <p style="text-align: right; margin-right: 10px">
                            <input type="submit" name="action" value="Add" />
                        </p>
                        <?php echo form_close(); ?>
                        
                        <?php endif; ?>
                        <?php if (count($owners) > 0): ?>
                        <h5>List of owners</h5>
                        <ul>
                        <?php foreach ($owners as $e): ?>
                            <li>
                                <?php echo anchor('profile/person/edit/'.$e->id, $e->name); ?>
                                [<?php echo anchor('owner/role/owners/delete/'.$e->id, 'x')?>]
                            </li>
                        <?php endforeach; ?>
                        </ul>
                        <?php endif; ?>
                    </div>
            </div>
        </div> <!-- end content -->
        <?php $this->load->view('menu/admin')?>
    </div> <!-- end container -->
</div> <!-- end main -->
<?php $this->load->view('footer/standard');?>